package com.lankystar.logistucs.spring.dao.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.lankystar.logistucs.spring.dao.ITruckStatusDao;
import com.lankystar.logistucs.spring.entity.TruckStatus;
import com.lankystar.logistucs.spring.entity.TwoStatus;

@Repository
public class TruckStatusDaoImpl extends BaseDaoImpl implements ITruckStatusDao {

	@Autowired
	private SessionFactory sf;
	
	public Session getSession(){
		System.out.println("session oneOrderDaoImpl");
		return sf.getCurrentSession();
	}

	@Override
	public TruckStatus selectTruckStatusById(int truckStatusId) {
		TruckStatus truckStatus = (TruckStatus) getSession().get(TruckStatus.class, truckStatusId);
		return truckStatus;
	}

	@Override
	public TruckStatus selectTruckStatusBykey(int truckStatusKey) {
		String sql = "from TruckStatus where truckStatusKey = ?";
		TruckStatus truckStatus = (TruckStatus) getSession().createQuery(sql).setInteger(0, truckStatusKey).uniqueResult();
		return truckStatus;
	}
}
